//
//  YRJSearchResultDiscountCollectionViewCell.m
//  YanRenjie
//
//  Created by dllo on 15/11/4.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJSearchResultDiscountCollectionViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation YRJSearchResultDiscountCollectionViewCell
- (void)dealloc {
    [_picImageView release];
    [_titleLabel release];
    [_departureTimeLabel release];
    [_priceLabel release];
    [_lastminute_desLabel release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.picImageView = [[UIImageView alloc] init];
    [self addSubview:self.picImageView];
    [_picImageView release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self addSubview:self.titleLabel];
    [_titleLabel release];
    self.titleLabel.numberOfLines = 2;
    self.titleLabel.font = [UIFont systemFontOfSize:14];
//    self.titleLabel.layer.borderWidth = 1;
    self.titleLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
    
    self.departureTimeLabel = [[UILabel alloc] init];
    [self addSubview:self.departureTimeLabel];
    [_departureTimeLabel release];
    self.departureTimeLabel.font = [UIFont systemFontOfSize:10];
//    self.departureTimeLabel.layer.borderWidth = 1;
    self.departureTimeLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
    
    self.priceLabel = [[UILabel alloc] init];
    [self addSubview:self.priceLabel];
    [_priceLabel release];
    self.priceLabel.font = [UIFont systemFontOfSize:10];
//    self.priceLabel.layer.borderWidth = 1;
    self.priceLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
    
    self.lastminute_desLabel = [[UILabel alloc] init];
    [self addSubview:self.lastminute_desLabel];
    [_lastminute_desLabel release];
    self.lastminute_desLabel.font = [UIFont systemFontOfSize:10];
//    self.lastminute_desLabel.layer.borderWidth = 1;
    self.lastminute_desLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.picImageView.frame = CGRectMake(0, 0, WIDTH, HEIGHT / 2);
    self.titleLabel.frame = CGRectMake(0, HEIGHT / 2, WIDTH, HEIGHT / 4);
    self.departureTimeLabel.frame = CGRectMake(0, HEIGHT / 4 * 3, WIDTH, HEIGHT / 8);
    self.priceLabel.frame = CGRectMake(0, HEIGHT / 8 * 7, WIDTH / 4 * 3, HEIGHT / 8);
    self.lastminute_desLabel.frame = CGRectMake(WIDTH / 4 * 3, HEIGHT / 8 * 7, WIDTH / 4, HEIGHT / 8);
}
@end
